package com.zhentao.controller;

import com.zhentao.service.MinioService;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class UserAvatarController {
    @Autowired
    private MinioService service;

    @RequestMapping("/upload")
    public Result upload(MultipartFile multipartFile){
        String upload = service.upload(multipartFile);
        if (upload.equals("上传成功")){
            return Result.OK(upload);
        }else{
            return Result.ERROR("有违规内容不可上传");
        }
    }
}
